﻿<!doctype html>
<html>
<head>
    <title>SpreadJS - Basic Comment</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    
    <link href="../../../external/spreadjs/css/gcspread.sheets.excel2013white.9.40.20161.0.css" rel="stylesheet" type="text/css" />

    <script src="../../../external/external/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../../external/spreadjs/gcspread.sheets.all.9.40.20161.0.min.js"></script>

    <style type="text/css">
    /*css_begin*/
        label {
            display: inline-block;
            width: 100px;
        }
    /*css_end*/
    </style>


    <script id="scriptInit" type="text/javascript">
        /*code_begin*/
        $(document).ready(function () {
            var spread = new GcSpread.Sheets.Spread(document.getElementById("ss"));
            initSpread(spread);
        });

        function initSpread(spread) {
            var spreadNS = GcSpread.Sheets;
            
            var sheet = spread.getSheet(0);
            var comment = new spreadNS.Comment();
            comment.text("new comment!");
            sheet.setComment(1, 1, comment);

            $("#btnAddComment").click(function () {
                var row = parseInt($("#txtRowIndex").val());
                var col = parseInt($("#txtColumnIndex").val());
                var comment = new spreadNS.Comment();
                comment.text($("#txtComment").val());

                sheet.setComment(row, col, comment);
            })
        };
        /*code_end*/
    </script>

</head>
<body>
<div class="sample-turtorial">
    <div id="ss" style="width:100%; height:380px;border: 1px solid gray;"></div>
    <div class="demo-options">
        <div class="option-row">
            <label for="txtRowIndex">Row index:</label>
            <input id ="txtRowIndex" type ="text" value="5"/>
        </div>
        <div class="option-row">
            <label for="txtColumnIndex">Column index:</label>
            <input id ="txtColumnIndex" type ="text" value="2"/>
        </div>
        <div class="option-row">
            <label for="txtComment">Comment text:</label>
            <input id ="txtComment" type ="text" value="comment demo"/>
        </div>
        <div class="option-row">
            <input type="button" id="btnAddComment" value="AddComment" />
        </div>
    </div>
</div>
</body>
</html>
